// Singleton.hpp
#pragma once

namespace CORE
{
	template <typename T>
	class Singleton
	{
	public:
		Singleton() {
			g_StaticInstance = static_cast<T*>(this);
		}

		static T * getInstance() {
			if (NULL == g_StaticInstance) {
				Singleton();
			}

			return g_StaticInstance;
		}

	protected:

		static T * g_StaticInstance;
	};

	template <typename T>
	T * Singleton<T>::g_StaticInstance = NULL;
}